#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void P(int* p, int n) {//1,2,3,4,5,6,7,8,9,10
	for (int i =0 ; i<n; i++) {
		int* max=p+i;
		for (int j = i; j < n; j++) {
			if (*(p + j) > *max) 
				max = (p + j);
		}
		if (*max == *(p + i))
			continue;

			int tmpe = *(p + i);
			*(p + i) = *max;
			*max = tmpe;
	}
}
int main() {
	int a[10] = { 10,9,8,7,6,5,4,3,1,2 };
	int n = sizeof(a) / sizeof(a[0]);
	P(a, n);
	for (int i = 0; i < n; i++)
	printf("%d ",a[i]);
	return 0;
}